package com.bw.coll;

import com.bw.dao.Emp;
import com.bw.dao.Ps;
import com.bw.service.EmpService;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class EmpColl {

    @Autowired
    EmpService emp;

    @RequestMapping("/list1")
    public Map getList1(){
        List<Emp> list1 = emp.getList1();
        return SugarUtil.getBarData(list1);
    }

    @RequestMapping("/list2")
    public Map getList2(){
        List<Emp> list1 = emp.getList2();
        return SugarUtil.getPieData(list1);
    }

    @RequestMapping("/list3")
    public Map getList3(){
        List<Emp> list1 = emp.getList3();
        return SugarUtil.getPieData(list1);
    }

    @RequestMapping("/list4")
    public String getList4(){
        List<Ps> list1 = emp.getList4();
        ArrayList<String> list = new ArrayList<>();
        list.add("品牌");
        list.add("性别");
        list.add("金额");
        return SugarUtil.getTablePlayData(list,list1);
    }

}
